<div class="users form">
<?php echo $this->Form->create('User');?>
    <fieldset>
         <legend><?php __('Add User'); ?></legend>
    <?php
        echo $this->Form->input('username');
        echo $this->Form->input('password');
        echo $this->Form->input('password_confirm', array('div' => 'input text required', 'type' => 'password'));
        echo $this->Form->input('email');
        echo $this->Form->input('member_id');
        $this->Js->get('#UserMemberId');
        $this->Js->event('change', '
            if ($(this).val() == -1) {
                $("#MemberNameDiv").removeClass("hidden");
                $("#MemberCamarillaNumberDiv").removeClass("hidden");
                $("#MemberLocationDiv").removeClass("hidden");
            } else {
                $("#MemberNameDiv").addClass("hidden");
                $("#MemberCamarillaNumberDiv").addClass("hidden");
                $("#MemberLocationDiv").addClass("hidden");
            }
        ');
        echo $this->Form->input('Member.name', array('div' => array('class' => 'input text required' . (empty($this->data['User']['member_id']) || $this->data['User']['member_id'] != -1 ? ' hidden' : ''), 'id' => 'MemberNameDiv')));
        echo $this->Form->input('Member.camarilla_number', array('div' => array('class' => 'input text required' . (empty($this->data['User']['member_id']) || $this->data['User']['member_id'] != -1 ? ' hidden' : ''), 'id' => 'MemberCamarillaNumberDiv')));
        echo $this->Form->input('Member.location_id', array('div' => array('class' => 'input select required' . (empty($this->data['User']['member_id']) || $this->data['User']['member_id'] != -1 ? ' hidden' : ''), 'id' => 'MemberLocationDiv')));
        echo $this->Form->input('group_id', array('type' => 'hidden'));
        echo $this->Recaptcha->display_form();
        if (!empty($reCaptchaFailed) && $reCaptchaFailed == true) {
            echo $this->Html->div('error-message', 'ReCAPTCHA authentication failed');
        }
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
    <h3><?php __('Actions'); ?></h3>
    <ul>

        <li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index'));?></li>
        <li><?php echo $this->Html->link(__('List Members', true), array('controller' => 'members', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Member', true), array('controller' => 'members', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Groups', true), array('controller' => 'groups', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Group', true), array('controller' => 'groups', 'action' => 'add')); ?> </li>
    </ul>
</div>